
import React, { useState } from 'react'
import _ from 'lodash'

export default function AV() {
    const [aaa, setaaa] = useState([
        { id: "20", name: "张飞" },
        { id: "16", name: "刘备" },
        { id: "73", name: "关宇哥" }
    ])

    //排序用法
    const handle = () => {
        setaaa(_.orderBy(aaa, 'id', 'esc'))

    }

    return (
        <div>
            <button onClick={handle}>点击</button>
            {/* map遍历数组 */}
            {aaa.map(item => <div key={item.id}>{item.name}+{item.id}</div>)}
        </div>

    )
}
